package com.wlr.study.leetcode;

import java.util.Arrays;

/**
 * @author lerong.wang
 * @version 1.0.0
 * @description
 * @date 2025/1/6 18:46
 */
public class LeetCode2274 {
    public int maxConsecutive(int bottom, int top, int[] special) {
        Arrays.sort(special);
        int ans = 0;
        ans = Math.max(ans, special[0] - bottom);
        for (int i = 1; i < special.length; ++i) {
            ans = Math.max(ans, special[i] - special[i - 1] - 1);
        }
        ans = Math.max(ans, top - special[special.length - 1]);
        return ans;
    }

    public static void main(String[] args) {
        LeetCode2274 leetcode2274 = new LeetCode2274();
        int i = leetcode2274.maxConsecutive(2, 9, new int[]{4, 6});
        System.out.println(i);
    }

}